/* 
	Anything regarding the toolgun should be kept in this file.
*/

//The below function and table effectively just prevents users from toolgunning certain entities.
//It saves the trouble of expecting admin mods to automatically cater for it (or people wondering their ents have went).
//If you don't want an ent to be touched, add it to the table below.
local BlacklistedEnts={"func_","prop_door","prop_s","sent_","spawned","env","cse","gun","drug","weapon","money","send_keypad"}

local function NoEntTouching(ply, tr, toolmode)
	if !ply:IsAdmin() then return end 
		
	if (tr.Entity:GetClass() == "prop_ragdoll" and !ply:IsAdmin()) then
		return false
	end
	
	for _, badents in pairs (BlacklistedEnts) do
		if string.find(tr.Entity:GetClass(),badents) then return false end
	end
	
	return true
end
hook.Add("CanTool","NoTouchyEnts",NoEntTouching)


